//------------------------------------------------------------------------------//
// 
// MODULE	: GameStartPoint.cpp
// 
// PURPOSE	: GameStartPoint - Implementation
// 
// CREATED	: 06/27/2002
// 
// (c) 2002 LithTech, Inc.	All Rights Reserved
// 
//------------------------------------------------------------------------------//

#include "GameStartPoint.h"

#include <ltobjectcreate.h>
#include "world_option.h"

//-----------------------------------------------------------------------------
BEGIN_CLASS(game_start_point)
ADD_LONGINTPROP(GameType, 0)
END_CLASS_DEFAULT_FLAGS(game_start_point, BaseClass, LTNULL, LTNULL, CF_ALWAYSLOAD)


//-----------------------------------------------------------------------------
//	game_start_point::PreCreate(void *pData, float fData)
//
//-----------------------------------------------------------------------------
uint32 game_start_point::OnPrecreate(ObjectCreateStruct *pData, float fData) {
	// Let parent class handle it first
    BaseClass::OnPrecreate(pData, fData) ;
    
	
	// Cast pData to a ObjectCreateStruct* for convenience
	
	
	// Set the object type to OT_NORMAL
	pData->m_ObjectType = OT_NORMAL;
	
	// Check to see if this is coming from a world file
	if(fData == PRECREATE_WORLDFILE)	  
	{
		read_props(pData);
	}
	
	// Return default of 1
	return 1;
}


//-----------------------------------------------------------------------------
//	game_start_point::ReadProps(ObjectCreateStruct* pStruct)
//
//-----------------------------------------------------------------------------
void game_start_point::read_props(ObjectCreateStruct* pStruct) {
	g_pLTServer->GetPropString("Name", pStruct->m_Filename, MAX_CS_FILENAME_LEN);
  g_pLTServer->GetPropLongInt("GameType", &m_game_type) ;
  world_option::instance().set_game_type(m_game_type) ;
  
}
